﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XTeam.Document.Entities;
using XTeam.Document.Factory.DataAccessInterface;
using Spring.Context;
using Spring.Context.Support;

namespace XTeam.Documents.Business
{
    public class ArticlClassifyBLL : BasicBLL
    {
        private IArticleClassifyDataAccess _articleClassifyDal;

        public ArticlClassifyBLL()
        {
            IApplicationContext _context = ContextRegistry.GetContext();
            _articleClassifyDal = (IArticleClassifyDataAccess)_context.GetObject("ArticleClassifyDataAccess");
        }

        public ArticleClassifyEntity Find(int classId)
        {
            return _articleClassifyDal.Find<ArticleClassifyEntity>(i => i.ClassId == classId);
        }

        public IList<ArticleClassifyEntity> Search(Func<ArticleClassifyEntity, bool> filter)
        {
            return _articleClassifyDal.Search(filter).ToList();
        }

        public int Update(IList<ArticleClassifyEntity> entities, Func<ArticleClassifyEntity, object> fields = null, bool withOut = false)
        {
            return _articleClassifyDal.Update(entities, fields);

        }

        public int Delete(IList<ArticleClassifyEntity> entities)
        {
            return _articleClassifyDal.Delete(entities);
        }

        public int Append(IList<ArticleClassifyEntity> entities)
        {
            return _articleClassifyDal.Append(entities);
        }
    }
}
